<?php
/*   datacsv.php   */
//var_dump(microtime());
$length_chart=300;
$csvfile = "A".rand(1,9).".csv";
$file_handle = fopen($csvfile, "r");
$line_of_text = array();
while (!feof($file_handle) ) {
    $line_of_text[] = fgetcsv($file_handle, 1024);
}
fclose($file_handle);
// Random Row and Column
$random_row_start = rand(0,count($line_of_text)-$length_chart);
for($i=$random_row_start;$i<($random_row_start+$length_chart);$i++)
{
   //$output_array[]="[".join(",",$line_of_text[$i])."]";
   $output_array[]="[".($i+1-$random_row_start).",".$line_of_text[$i][2].",".$line_of_text[$i][3].",".$line_of_text[$i][4].",".$line_of_text[$i][5]."]";
}
echo "[ ".join(", ",$output_array)." ]";
//var_dump(microtime());
?>